/****************************************************************************
 *
 *   Copyright (c) 2020-2023 PX4 Development Team. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 * 3. Neither the name PX4 nor the names of its contributors may be
 *    used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 ****************************************************************************/

#include <stdint.h>

static constexpr float SAMPLING_RES = 10;
static constexpr float SAMPLING_MIN_LAT = -90;
static constexpr float SAMPLING_MAX_LAT = 90;
static constexpr float SAMPLING_MIN_LON = -180;
static constexpr float SAMPLING_MAX_LON = 180;

static constexpr int LAT_DIM = 19;
static constexpr int LON_DIM = 37;


// *INDENT-OFF*
// Magnetic declination data in radians * 10^-4
// Model: WMM-2020,
// Version: 0.5.1.11,
// Date: 2023.5698,
static constexpr const int16_t declination_table[19][37] {
	//    LONGITUDE:   -180,  -170,  -160,  -150,  -140,  -130,  -120,  -110,  -100,   -90,   -80,   -70,   -60,   -50,   -40,   -30,   -20,   -10,     0,    10,    20,    30,    40,    50,    60,    70,    80,    90,   100,   110,   120,   130,   140,   150,   160,   170,   180,
	/* LAT: -90 */ {  25961, 24216, 22470, 20725, 18980, 17234, 15489, 13744, 11999, 10253,  8508,  6763,  5017,  3272,  1527,  -218, -1964, -3709, -5454, -7200, -8945,-10690,-12436,-14181,-15926,-17672,-19417,-21162,-22908,-24653,-26398,-28144,-29889, 31197, 29452, 27707, 25961, },
	/* LAT: -80 */ {  22525, 20397, 18459, 16687, 15048, 13510, 12047, 10636,  9262,  7912,  6581,  5262,  3953,  2649,  1341,    21, -1321, -2695, -4106, -5560, -7057, -8595,-10175,-11795,-13461,-15181,-16968,-18842,-20826,-22946,-25222,-27657,-30225, 29969, 27354, 24852, 22525, },
	/* LAT: -70 */ {  14984, 13584, 12455, 11491, 10620,  9786,  8942,  8054,  7100,  6080,  5010,  3918,  2834,  1780,   760,  -250, -1288, -2396, -3601, -4906, -6291, -7724, -9175,-10619,-12046,-13464,-14894,-16383,-18011,-19933,-22468,-26286, 30626, 24107, 19619, 16854, 14984, }, // WARNING! black out zone
	/* LAT: -60 */ {   8445,  8195,  7909,  7630,  7372,  7115,  6804,  6368,  5751,  4929,  3926,  2815,  1697,   674,  -202,  -955, -1683, -2510, -3521, -4727, -6066, -7441, -8765, -9976,-11040,-11937,-12651,-13145,-13317,-12868,-10758, -3423,  5005,  7715,  8469,  8586,  8445, }, // WARNING! black out zone
	/* LAT: -50 */ {   5504,  5539,  5479,  5386,  5309,  5269,  5231,  5102,  4755,  4088,  3074,  1799,   461,  -712, -1571, -2124, -2514, -2957, -3655, -4685, -5944, -7229, -8372, -9271, -9863,-10094, -9890, -9124, -7608, -5240, -2331,   418,  2528,  3954,  4828,  5302,  5504, },
	/* LAT: -40 */ {   3969,  4061,  4066,  4017,  3954,  3917,  3920,  3907,  3731,  3191,  2162,   715,  -847, -2151, -2999, -3436, -3608, -3662, -3841, -4436, -5439, -6526, -7409, -7938, -8033, -7641, -6739, -5349, -3641, -1945,  -490,   730,  1775,  2645,  3304,  3737,  3969, },
	/* LAT: -30 */ {   2995,  3081,  3108,  3089,  3027,  2946,  2884,  2849,  2720,  2237,  1192,  -335, -1941, -3183, -3907, -4238, -4304, -4078, -3641, -3446, -3846, -4609, -5302, -5638, -5497, -4896, -3929, -2724, -1526,  -591,    80,   679,  1306,  1914,  2429,  2794,  2995, },
	/* LAT: -20 */ {   2353,  2398,  2411,  2408,  2362,  2265,  2154,  2076,  1930,  1429,   362, -1135, -2611, -3658, -4173, -4274, -4057, -3483, -2616, -1836, -1590, -1966, -2617, -3076, -3099, -2729, -2089, -1277,  -511,   -31,   225,   524,   969,  1455,  1884,  2196,  2353, },
	/* LAT: -10 */ {   1959,  1952,  1927,  1918,  1886,  1798,  1683,  1590,  1404,   849,  -222, -1604, -2872, -3685, -3933, -3688, -3102, -2315, -1470,  -724,  -274,  -324,  -804, -1306, -1510, -1413, -1097,  -601,  -112,   121,   162,   319,   694,  1141,  1542,  1836,  1959, },
	/* LAT:   0 */ {   1746,  1711,  1651,  1637,  1622,  1549,  1438,  1320,  1065,   442,  -603, -1831, -2877, -3448, -3427, -2913, -2141, -1361,  -713,  -181,   226,   327,    38,  -379,  -629,  -681,  -583,  -324,   -40,    42,   -27,    58,   404,   856,  1285,  1612,  1746, },
	/* LAT:  10 */ {   1607,  1614,  1568,  1580,  1602,  1549,  1421,  1230,   853,   135,  -887, -1960, -2777, -3102, -2883, -2267, -1489,  -781,  -271,   106,   429,   571,   402,    79,  -152,  -260,  -286,  -210,  -110,  -158,  -304,  -281,    26,   490,   979,  1393,  1607, },
	/* LAT:  20 */ {   1417,  1565,  1623,  1713,  1796,  1772,  1612,  1306,   761,   -94, -1134, -2079, -2666, -2763, -2425, -1818, -1107,  -461,    -5,   301,   558,   700,   604,   360,   163,    43,   -54,  -125,  -210,  -405,  -646,  -706,  -468,   -13,   534,  1057,  1417, },
	/* LAT:  30 */ {   1107,  1473,  1732,  1955,  2114,  2122,  1932,  1507,   779,  -247, -1358, -2226, -2630, -2560, -2156, -1574,  -918,  -303,   156,   458,   688,   831,   806,   656,   508,   382,   218,    -2,  -291,  -670, -1040, -1199, -1036,  -605,   -25,   586,  1107, },
	/* LAT:  40 */ {    739,  1324,  1819,  2213,  2463,  2506,  2290,  1757,   847,  -374, -1602, -2458, -2770, -2613, -2165, -1571,  -918,  -290,   217,   579,   847,  1042,  1131,  1118,  1042,   892,   615,   193,  -354,  -964, -1484, -1725, -1604, -1185,  -587,    83,   739, },
	/* LAT:  50 */ {    437,  1182,  1864,  2425,  2795,  2904,  2677,  2027,   892,  -593, -2001, -2905, -3194, -3000, -2510, -1864, -1154,  -458,   156,   659,  1075,  1426,  1702,  1869,  1885,  1692,  1237,   515,  -389, -1293, -1967, -2247, -2118, -1677, -1047,  -322,   437, },
	/* LAT:  60 */ {    223,  1072,  1879,  2579,  3090,  3310,  3104,  2305,   811, -1124, -2822, -3795, -4048, -3790, -3220, -2477, -1653,  -815,    -9,   740,  1430,  2058,  2597,  2987,  3140,  2943,  2288,  1154,  -272, -1589, -2448, -2749, -2582, -2093, -1409,  -618,   223, },
	/* LAT:  70 */ {    -44,   886,  1782,  2584,  3205,  3510,  3278,  2184,    16, -2634, -4572, -5410, -5435, -4965, -4205, -3277, -2258, -1196,  -125,   932,  1955,  2919,  3784,  4486,  4926,  4946,  4316,  2812,   593, -1517, -2805, -3242, -3084, -2560, -1821,  -962,   -44, }, // WARNING! black out zone
	/* LAT:  80 */ {   -858,    61,   911,  1602,  1994,  1843,   745, -1647, -4659, -6762, -7572, -7500, -6914, -6027, -4957, -3773, -2518, -1221,    99,  1422,  2734,  4015,  5242,  6381,  7379,  8141,  8483,  8021,  6019,  2077, -1609, -3310, -3650, -3308, -2627, -1777,  -858, }, // WARNING! black out zone
	/* LAT:  90 */ { -29448,-27702,-25957,-24211,-22466,-20721,-18975,-17230,-15485,-13740,-11994,-10249, -8504, -6759, -5014, -3269, -1524,   222,  1967,  3712,  5457,  7202,  8948, 10693, 12438, 14184, 15929, 17675, 19420, 21165, 22911, 24657, 26402, 28148, 29893,-31193,-29448, }, // WARNING! black out zone
};
static constexpr float WMM_DECLINATION_MIN_RAD = -3.119; // latitude: 90, longitude: 170
static constexpr float WMM_DECLINATION_MAX_RAD = 3.120; // latitude: -90, longitude: 150


// Magnetic inclination data in radians * 10^-4
// Model: WMM-2020,
// Version: 0.5.1.11,
// Date: 2023.5698,
static constexpr const int16_t inclination_table[19][37] {
	//    LONGITUDE:   -180,  -170,  -160,  -150,  -140,  -130,  -120,  -110,  -100,   -90,   -80,   -70,   -60,   -50,   -40,   -30,   -20,   -10,     0,    10,    20,    30,    40,    50,    60,    70,    80,    90,   100,   110,   120,   130,   140,   150,   160,   170,   180,
	/* LAT: -90 */ { -12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565,-12565, },
	/* LAT: -80 */ { -13648,-13514,-13353,-13173,-12979,-12778,-12575,-12375,-12184,-12008,-11852,-11718,-11608,-11522,-11458,-11416,-11396,-11399,-11426,-11480,-11564,-11678,-11824,-11998,-12196,-12414,-12643,-12876,-13104,-13316,-13502,-13652,-13755,-13806,-13802,-13747,-13648, },
	/* LAT: -70 */ { -14095,-13777,-13457,-13135,-12803,-12460,-12105,-11749,-11407,-11099,-10848,-10665,-10554,-10502,-10487,-10489,-10494,-10502,-10524,-10580,-10688,-10864,-11112,-11428,-11802,-12221,-12670,-13134,-13600,-14052,-14469,-14812,-14997,-14941,-14709,-14411,-14095, }, // WARNING! black out zone
	/* LAT: -60 */ { -13512,-13158,-12819,-12486,-12143,-11771,-11356,-10902,-10436,-10007, -9680, -9508, -9507, -9646, -9849,-10038,-10158,-10196,-10180,-10163,-10211,-10373,-10666,-11078,-11579,-12137,-12724,-13321,-13909,-14471,-14968,-15257,-15075,-14688,-14281,-13886,-13512, }, // WARNING! black out zone
	/* LAT: -50 */ { -12493,-12150,-11818,-11496,-11172,-10826,-10427, -9956, -9428, -8909, -8524, -8404, -8611, -9076, -9638,-10145,-10496,-10649,-10610,-10452,-10310,-10321,-10549,-10972,-11519,-12113,-12699,-13236,-13681,-13977,-14084,-14011,-13807,-13522,-13193,-12844,-12493, },
	/* LAT: -40 */ { -11239,-10889,-10540,-10194, -9854, -9517, -9157, -8733, -8213, -7651, -7231, -7200, -7671, -8500, -9421,-10244,-10895,-11319,-11444,-11264,-10916,-10649,-10653,-10944,-11411,-11917,-12359,-12677,-12833,-12837,-12748,-12612,-12434,-12203,-11916,-11587,-11239, },
	/* LAT: -30 */ {  -9602, -9220, -8838, -8446, -8054, -7680, -7326, -6937, -6426, -5816, -5373, -5473, -6260, -7471, -8720, -9809,-10714,-11413,-11796,-11769,-11385,-10877,-10553,-10563,-10821,-11143,-11395,-11503,-11437,-11261,-11089,-10959,-10816,-10611,-10330, -9983, -9602, },
	/* LAT: -20 */ {  -7373, -6926, -6504, -6074, -5630, -5201, -4814, -4405, -3842, -3159, -2722, -3007, -4143, -5767, -7392, -8749, -9801,-10563,-10985,-11002,-10625,-10004, -9450, -9216, -9271, -9434, -9572, -9584, -9409, -9138, -8949, -8869, -8772, -8568, -8252, -7837, -7373, },
	/* LAT: -10 */ {  -4418, -3873, -3412, -2972, -2514, -2065, -1655, -1208,  -588,   110,   457,     3, -1355, -3288, -5257, -6846, -7920, -8537, -8787, -8710, -8286, -7592, -6930, -6592, -6558, -6651, -6766, -6785, -6595, -6301, -6153, -6175, -6146, -5935, -5552, -5020, -4418, },
	/* LAT:   0 */ {   -911,  -276,   197,   603,  1022,  1438,  1824,  2259,  2834,  3402,  3590,  3070,  1748,  -179, -2218, -3846, -4828, -5237, -5283, -5102, -4648, -3921, -3216, -2852, -2794, -2861, -2984, -3055, -2924, -2691, -2645, -2805, -2883, -2703, -2278, -1643,  -911, },
	/* LAT:  10 */ {   2557,  3193,  3635,  3979,  4335,  4701,  5049,  5427,  5869,  6230,  6254,  5748,  4646,  3066,  1379,    22,  -759,  -988,  -884,  -641,  -220,   428,  1061,  1394,  1457,  1417,  1319,  1228,  1270,  1370,  1285,  1003,   796,   861,  1214,  1822,  2557, },
	/* LAT:  20 */ {   5413,  5949,  6333,  6630,  6944,  7287,  7626,  7967,  8292,  8485,  8388,  7914,  7067,  5964,  4841,  3945,  3432,  3327,  3487,  3736,  4072,  4544,  5004,  5258,  5316,  5304,  5258,  5200,  5186,  5164,  4983,  4639,  4331,  4236,  4409,  4836,  5413, },
	/* LAT:  30 */ {   7568,  7944,  8264,  8547,  8857,  9203,  9558,  9894, 10165, 10273, 10121,  9693,  9059,  8347,  7689,  7185,  6903,  6870,  7019,  7234,  7485,  7788,  8077,  8251,  8309,  8326,  8331,  8321,  8296,  8210,  7982,  7623,  7262,  7039,  7023,  7220,  7568, },
	/* LAT:  40 */ {   9266,  9487,  9744, 10029, 10355, 10715, 11081, 11416, 11664, 11742, 11588, 11226, 10752, 10280,  9887,  9608,  9464,  9466,  9581,  9745,  9924, 10110, 10283, 10408, 10487, 10550, 10607, 10641, 10622, 10508, 10262,  9908,  9538,  9252,  9109,  9122,  9266, },
	/* LAT:  50 */ {  10802, 10923, 11123, 11392, 11714, 12067, 12419, 12733, 12952, 13009, 12868, 12570, 12207, 11863, 11591, 11407, 11317, 11317, 11387, 11493, 11608, 11726, 11843, 11959, 12078, 12203, 12317, 12390, 12378, 12250, 12001, 11671, 11331, 11046, 10856, 10776, 10802, },
	/* LAT:  60 */ {  12320, 12391, 12540, 12756, 13024, 13323, 13624, 13888, 14063, 14090, 13955, 13708, 13420, 13151, 12932, 12777, 12689, 12659, 12677, 12726, 12796, 12882, 12989, 13123, 13283, 13460, 13625, 13732, 13735, 13612, 13386, 13107, 12829, 12592, 12422, 12330, 12320, },
	/* LAT:  70 */ {  13757, 13798, 13891, 14031, 14208, 14410, 14616, 14797, 14902, 14885, 14751, 14552, 14336, 14133, 13960, 13827, 13733, 13680, 13662, 13675, 13718, 13791, 13896, 14033, 14201, 14389, 14573, 14712, 14756, 14681, 14519, 14321, 14126, 13962, 13841, 13772, 13757, }, // WARNING! black out zone
	/* LAT:  80 */ {  14993, 15004, 15040, 15097, 15172, 15255, 15332, 15378, 15364, 15290, 15181, 15059, 14938, 14825, 14726, 14644, 14583, 14542, 14524, 14528, 14555, 14605, 14677, 14770, 14883, 15010, 15146, 15278, 15386, 15429, 15387, 15298, 15201, 15115, 15050, 15008, 14993, }, // WARNING! black out zone
	/* LAT:  90 */ {  15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15398, 15398, 15398, 15398, 15398, 15398, 15398, 15398, 15398, 15398, 15398, 15398, 15398, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, 15399, }, // WARNING! black out zone
};
static constexpr float WMM_INCLINATION_MIN_RAD = -1.526; // latitude: -60, longitude: 130
static constexpr float WMM_INCLINATION_MAX_RAD = 1.543; // latitude: 80, longitude: 110


// Magnetic strength data in milli-Gauss * 10
// Model: WMM-2020,
// Version: 0.5.1.11,
// Date: 2023.5698,
static constexpr const int16_t strength_table[19][37] {
	//    LONGITUDE:  -180, -170, -160, -150, -140, -130, -120, -110, -100,  -90,  -80,  -70,  -60,  -50,  -40,  -30,  -20,  -10,    0,   10,   20,   30,   40,   50,   60,   70,   80,   90,  100,  110,  120,  130,  140,  150,  160,  170,  180,
	/* LAT: -90 */ {  5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, 5445, },
	/* LAT: -80 */ {  6052, 5988, 5908, 5816, 5713, 5601, 5482, 5360, 5238, 5118, 5004, 4899, 4805, 4726, 4663, 4619, 4595, 4593, 4615, 4661, 4732, 4827, 4942, 5074, 5218, 5368, 5518, 5661, 5792, 5906, 5998, 6067, 6111, 6130, 6125, 6098, 6052, },
	/* LAT: -70 */ {  6297, 6162, 6011, 5845, 5666, 5473, 5268, 5053, 4834, 4619, 4417, 4235, 4078, 3947, 3844, 3767, 3721, 3709, 3738, 3815, 3944, 4125, 4355, 4623, 4919, 5227, 5530, 5814, 6064, 6267, 6418, 6513, 6554, 6545, 6495, 6409, 6297, },
	/* LAT: -60 */ {  6182, 5989, 5786, 5576, 5357, 5122, 4865, 4586, 4294, 4005, 3739, 3512, 3334, 3200, 3101, 3028, 2977, 2957, 2984, 3076, 3246, 3499, 3828, 4215, 4638, 5073, 5494, 5878, 6202, 6450, 6612, 6690, 6691, 6627, 6512, 6360, 6182, },
	/* LAT: -50 */ {  5840, 5609, 5376, 5144, 4911, 4666, 4395, 4091, 3763, 3431, 3130, 2891, 2731, 2641, 2592, 2557, 2523, 2496, 2501, 2575, 2751, 3044, 3443, 3917, 4424, 4930, 5405, 5823, 6161, 6402, 6539, 6578, 6535, 6423, 6261, 6061, 5840, },
	/* LAT: -40 */ {  5391, 5144, 4898, 4657, 4422, 4184, 3929, 3645, 3331, 3005, 2708, 2486, 2371, 2346, 2365, 2385, 2388, 2374, 2361, 2391, 2525, 2805, 3227, 3744, 4291, 4814, 5280, 5666, 5958, 6144, 6232, 6234, 6163, 6031, 5849, 5630, 5391, },
	/* LAT: -30 */ {  4877, 4635, 4395, 4160, 3933, 3714, 3494, 3263, 3007, 2731, 2474, 2293, 2225, 2251, 2318, 2388, 2453, 2501, 2521, 2532, 2602, 2807, 3175, 3666, 4199, 4695, 5110, 5425, 5626, 5725, 5751, 5724, 5644, 5511, 5331, 5114, 4877, },
	/* LAT: -20 */ {  4320, 4106, 3896, 3691, 3495, 3312, 3143, 2979, 2801, 2602, 2411, 2279, 2240, 2286, 2376, 2487, 2614, 2740, 2826, 2859, 2886, 2986, 3232, 3620, 4072, 4498, 4843, 5075, 5179, 5186, 5155, 5108, 5026, 4898, 4731, 4534, 4320, },
	/* LAT: -10 */ {  3790, 3628, 3474, 3327, 3191, 3071, 2967, 2875, 2776, 2661, 2539, 2440, 2397, 2424, 2513, 2642, 2798, 2955, 3076, 3136, 3150, 3179, 3306, 3562, 3890, 4212, 4475, 4635, 4668, 4615, 4548, 4485, 4397, 4272, 4123, 3958, 3790, },
	/* LAT:   0 */ {  3412, 3318, 3233, 3160, 3105, 3066, 3039, 3019, 2994, 2945, 2865, 2772, 2693, 2665, 2709, 2814, 2946, 3081, 3194, 3268, 3298, 3321, 3398, 3558, 3769, 3983, 4162, 4266, 4271, 4202, 4114, 4022, 3911, 3780, 3645, 3520, 3412, },
	/* LAT:  10 */ {  3282, 3251, 3230, 3225, 3249, 3296, 3351, 3403, 3436, 3426, 3356, 3242, 3117, 3024, 3001, 3044, 3126, 3224, 3324, 3409, 3472, 3535, 3624, 3744, 3881, 4020, 4140, 4209, 4210, 4147, 4037, 3894, 3732, 3572, 3436, 3339, 3282, },
	/* LAT:  20 */ {  3399, 3401, 3426, 3479, 3570, 3690, 3818, 3934, 4014, 4025, 3952, 3810, 3645, 3507, 3434, 3424, 3460, 3534, 3631, 3728, 3820, 3919, 4030, 4143, 4252, 4365, 4468, 4533, 4543, 4483, 4345, 4142, 3914, 3704, 3540, 3439, 3399, },
	/* LAT:  30 */ {  3722, 3727, 3780, 3878, 4020, 4190, 4365, 4520, 4628, 4654, 4581, 4426, 4239, 4077, 3974, 3930, 3935, 3987, 4075, 4174, 4272, 4379, 4496, 4613, 4734, 4862, 4983, 5069, 5094, 5035, 4877, 4637, 4362, 4107, 3908, 3778, 3722, },
	/* LAT:  40 */ {  4222, 4218, 4281, 4403, 4568, 4754, 4937, 5093, 5198, 5224, 5156, 5008, 4823, 4651, 4525, 4451, 4427, 4451, 4512, 4593, 4680, 4778, 4893, 5027, 5178, 5341, 5493, 5602, 5640, 5584, 5427, 5188, 4914, 4655, 4444, 4298, 4222, },
	/* LAT:  50 */ {  4832, 4822, 4875, 4983, 5128, 5286, 5436, 5557, 5631, 5641, 5579, 5453, 5292, 5130, 4994, 4898, 4845, 4834, 4860, 4911, 4981, 5073, 5192, 5342, 5518, 5703, 5869, 5985, 6028, 5982, 5850, 5655, 5431, 5216, 5036, 4905, 4832, },
	/* LAT:  60 */ {  5393, 5377, 5402, 5463, 5548, 5641, 5729, 5796, 5830, 5823, 5770, 5677, 5557, 5430, 5312, 5217, 5151, 5118, 5117, 5146, 5203, 5290, 5408, 5556, 5722, 5890, 6037, 6139, 6182, 6159, 6076, 5950, 5805, 5663, 5541, 5448, 5393, },
	/* LAT:  70 */ {  5726, 5704, 5699, 5710, 5731, 5757, 5781, 5796, 5797, 5779, 5741, 5685, 5616, 5540, 5467, 5404, 5357, 5329, 5325, 5345, 5391, 5460, 5552, 5661, 5778, 5892, 5990, 6063, 6101, 6104, 6075, 6022, 5955, 5885, 5819, 5765, 5726, },
	/* LAT:  80 */ {  5790, 5772, 5756, 5744, 5733, 5724, 5714, 5703, 5688, 5671, 5649, 5625, 5598, 5572, 5547, 5527, 5514, 5509, 5515, 5530, 5556, 5591, 5634, 5682, 5732, 5779, 5822, 5856, 5880, 5893, 5895, 5888, 5873, 5854, 5832, 5810, 5790, },
	/* LAT:  90 */ {  5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, 5684, },
};
static constexpr float WMM_STRENGTH_MIN_GS = 22.3; // latitude: -30, longitude: -60
static constexpr float WMM_STRENGTH_MAX_GS = 66.9; // latitude: -60, longitude: 140
static constexpr float WMM_STRENGTH_MEAN_GS = 46.4;
static constexpr float WMM_STRENGTH_MEDIAN_GS = 48.8;


